﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cn.Edwon.Web.Crud {
    public class PropertyEO {
        private String _PropertyName;
        public String Name {
            set { _PropertyName = value; }
            get { return _PropertyName; }
        }

        private Boolean _InList = true;
        /// <summary>
        /// 是否在Select列表中显示，缺省为true
        /// </summary>
        public Boolean InList {
            set { _InList = value; }
            get { return _InList; 
            }
        }

        private Boolean _InForm = true;
        /// <summary>
        /// 是否在表单中显示，缺省为true
        /// </summary>
        public Boolean InForm {
            set { _InForm = value; }
            get {return _InForm;
            }
        }

        private Int32 _Length;
        /// <summary>
        /// 长度
        /// </summary>
        public Int32 Length {
            set { _Length = value; }
            get { return _Length; }
        }

        private String _DataType = "text";
        /// <summary>
        /// 输出的数据类型
        /// text: textbox
        /// textarea : textarea
        /// datatime : textbox
        /// select : select
        /// checkbox: checkbox
        /// radio : radio
        /// </summary>
        public String DataType {
            set { _DataType = value; }
            get { return _DataType; }
        }

        private Boolean _Editable = true;
        /// <summary>
        /// 是否可编辑，缺省为true；如果是不可编辑的项且在form中显示，则只绑定到label标签
        /// </summary>
        public Boolean Editable {
            set { _Editable = value; }
            get {return _Editable;
            }
        }

        private Type _Type;
        /// <summary>
        /// 属性的类型
        /// </summary>
        public Type Type {
            set { _Type = value; }
            get { return _Type; }
        }
        private Boolean _NotNull = false;
        /// <summary>
        /// 是否允许为空
        /// </summary>
        public Boolean NotNull {
            set { _NotNull = value; }
            get { return _NotNull; }
        }

        private Boolean _Unique = false;
        /// <summary>
        /// 是否是唯一值
        /// </summary>
        public Boolean Unique {
            get { return _Unique; }
            set { _Unique = value; }
        }

        private Object _Value = null;
        /// <summary>
        /// 字段的值
        /// </summary>
        public Object Value {
            set { _Value = value; }
            get { return _Value; }
        }

        private String _Label;
        public String Label {
            set { _Label = value; }
            get {
                if (_Label == null || _Label == "")
                    return _PropertyName;
                else
                    return _Label; }
        }
        private Boolean _InSearch = false;
        public Boolean InSearch {
            set { _InSearch = value; }
            get { return _InSearch; }
        }

        private String _DataSrc;
        public String DataSrc {
            set { _DataSrc = value; }
            get { return _DataSrc; }
        }
        private String _HtmlCode = "";
        public String HtmlCode {
            set { _HtmlCode = value; }
            get { return _HtmlCode; }
        }
        private String _Order = "";
        public String Order {
            get { return _Order; }
            set { _Order = value; }
        }

        private DataSourceEO _DataSource = null;
        public DataSourceEO DataSource {
            set { _DataSource = value; }
            get { return _DataSource; }
        }
    }
}
